"""
@Author : 合肥一元数智教育科技有限公司
@Date :  2025/11/5 15:12
@Description :   有参数的装饰器

"""


#  定义装饰器增强 add  sub
def outer_operation(operation):
    def operation_decorator(fn):
        def inner(*args, **kwargs):
            if operation == '+':
                print('-----------正在努力的进行加法计算-------------')
            if operation == '-':
                print('-----------正在努力的进行减法计算-------------')
            fn(*args, **kwargs)
        return inner
    return operation_decorator


@outer_operation('+')
def add_num(a, b):
    return a + b


@outer_operation('-')
def sub_num(a, b):
    return a - b


add_num(2, 3)
sub_num(4, 5)
